class MessageDataModel {
  MessageDataModel({
    required this.id,
    required this.createtime,
    required this.type,
    required this.isRead,
    required this.video,
    required this.adv,
    required this.messageContent,
  });

  late final String id;
  late final String createtime;
  late final String type;
  late int isRead;
  late final Video video;
  late final Adv adv;
  late final String messageContent;

  static List<MessageDataModel> fromList(List json) {
    return List.from(json).map((e) => MessageDataModel.fromJson(e)).toList();
  }

  MessageDataModel.fromJson(Map<String, dynamic> json) {
    id = json['id'].toString();
    createtime = json['createtime'];
    type = json['type'];
    isRead = json['is_read'];
    video = Video.fromJson(json['video'] is Map ? json['video'] : {});
    adv = Adv.fromJson(json['adv'] is Map ? json['adv'] : {});
    messageContent = json['message_content'];
  }

  Map<String, dynamic> toJson() {
    final _data = <String, dynamic>{};
    _data['id'] = id;
    _data['createtime'] = createtime;
    _data['type'] = type;
    _data['is_read'] = isRead;
    _data['video'] = video.toJson();
    _data['adv'] = adv.toJson();
    _data['message_content'] = messageContent;
    return _data;
  }
}

class Video {
  Video({
    this.id = 0,
    this.title = "",
    this.isJumpMiniprogram = 0,
    this.isJumpWeb = 0,
    this.minAge = 0,
    this.advOrigin = "",
  });

  late final int id;
  late final String title;
  late final int isJumpMiniprogram;
  late final int isJumpWeb;
  late final int minAge;
  late final String advOrigin;

  Video.fromJson(Map<String, dynamic> json) {
    id = json['id'] ?? 0;
    title = json['title'] ?? "";
    isJumpMiniprogram = json['is_jump_miniprogram'] ?? 0;
    isJumpWeb = json['is_jump_web'] ?? 0;
    minAge = json['min_age'] ?? 0;
    advOrigin = json['adv_origin'] ?? "";
  }

  Map<String, dynamic> toJson() {
    final _data = <String, dynamic>{};
    _data['id'] = id;
    _data['title'] = title;
    _data['is_jump_miniprogram'] = isJumpMiniprogram;
    _data['is_jump_web'] = isJumpWeb;
    _data['min_age'] = minAge;
    _data['adv_origin'] = advOrigin;
    return _data;
  }
}

class Adv {
  Adv({
    this.id = 0,
    this.nickname = "",
    this.avatar = "",
  });

  late final int id;
  late final String nickname;
  late final String avatar;

  Adv.fromJson(Map<String, dynamic> json) {
    id = json['id'] ?? 0;
    nickname = json['nickname'] ?? "";
    avatar = json['avatar'] ?? "";
  }

  Map<String, dynamic> toJson() {
    final _data = <String, dynamic>{};
    _data['id'] = id;
    _data['nickname'] = nickname;
    _data['avatar'] = avatar;
    return _data;
  }
}
